//
//  MCMyOrderTableCell.swift
//  MCBodyBuildingPro
//
//  Created by Renlvshijie on 2023/5/5.
//

import UIKit
import SnapKit
import QMUIKit

class MCMyOrderTableCell: UITableViewCell {
    
    
    var titleVipLabel:QMUILabel!
    var statusInfoLabel:MCPaddingLabel!
    var dateLabel:QMUILabel!
    var moneyLabel:QMUILabel!
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        self.contentView.backgroundColor = UIColor.qmui_color(withHexString: "#F7F7F9")
        loadSubView()
    }
    
    
    
    func loadSubView() -> Void {
        
        let containerView = UIView.init()
        containerView.backgroundColor = UIColor.white
        containerView.layer.cornerRadius = 8
        containerView.layer.masksToBounds = true
        self.contentView.addSubview(containerView)
        containerView.snp.makeConstraints { make in
            make.left.equalTo(self.contentView.snp.left).offset(16)
            make.right.equalTo(self.contentView.snp.right).offset(-16)
            make.centerY.equalTo(self.contentView.snp.centerY).offset(0)
            make.height.equalTo(74)
        }
        
        //自动续费-内容
        let titleVipInfoLabel = QMUILabel.init()
        titleVipInfoLabel.text = "年卡-自动续费"
        titleVipInfoLabel.textColor = UIColor.qmui_color(withHexString: "#333333")
        titleVipInfoLabel.font = UIFont(name: "PingFangSC-Semibold", size: 15)
        containerView.addSubview(titleVipInfoLabel)
        titleVipInfoLabel.snp.makeConstraints { make in
            make.left.equalTo(containerView.snp.left).offset(16)
            make.centerY.equalTo(containerView.snp.centerY).offset(0)
        }
        
        titleVipLabel = titleVipInfoLabel
        
        //自动续费-状态
        let statusLabel = MCPaddingLabel.init()
        statusLabel.leftInset = 10
        statusLabel.rightInset = 10
        statusLabel.topInset = 5
        statusLabel.bottomInset = 5
        statusLabel.text = "已取消"
        statusLabel.backgroundColor = UIColor.qmui_color(withHexString: "#35DE94")?.withAlphaComponent(0.1)
        statusLabel.textColor = UIColor.qmui_color(withHexString: "#109B5E")
        statusLabel.font = UIFont(name: "PingFangSC-Regular", size: 12)
        containerView.addSubview(statusLabel)
        statusLabel.snp.makeConstraints { make in
            make.left.equalTo(titleVipInfoLabel.snp.right).offset(10)
            make.centerY.equalTo(containerView.snp.centerY).offset(0)
        }
        
        statusInfoLabel = statusLabel
        
        
        //日期
        let dateInfoLabel = QMUILabel.init()
        dateInfoLabel.text = "2023/05/05 12:12"
        dateInfoLabel.textColor = UIColor.qmui_color(withHexString: "#999999")
        dateInfoLabel.font = UIFont(name: "PingFangSC-Regular", size: 12)
        containerView.addSubview(dateInfoLabel)
        dateInfoLabel.snp.makeConstraints { make in
            make.right.equalTo(containerView.snp.right).offset(-16)
            make.top.equalTo(containerView.snp.top).offset(10)
        }
        
        dateLabel = dateInfoLabel
        
        
        //金钱
        let moneyInfoLabel = QMUILabel.init()
        moneyInfoLabel.text = "¥98"
        moneyInfoLabel.textColor = UIColor.qmui_color(withHexString: "#333333")
        moneyInfoLabel.font = UIFont(name: "PingFangSC-Semibold", size: 18)
        containerView.addSubview(moneyInfoLabel)
        moneyInfoLabel.snp.makeConstraints { make in
            make.right.equalTo(containerView.snp.right).offset(-16)
            make.top.equalTo(dateInfoLabel.snp.bottom).offset(4)
        }
        
        moneyLabel = moneyInfoLabel
        
    }
    

}
